package com.shigen.demo.controller;

import com.shigen.demo.annotation.RequestLimit;
import com.shigen.demo.entity.req.ChartReq;
import com.shigen.demo.service.IChartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "chart")
@Api(tags = "echarts数据图数据")
@RequestLimit(second = 10)
public class ChartController {

  @Resource
  private IChartService chartService;

  @PostMapping(value = "getdata")
  @ApiOperation(value = "获得图表数据")
  public Object getChartData(@RequestBody @Validated ChartReq.OpBase opBase) {
    return chartService.getChartData(opBase.getToken(), String.valueOf(opBase.getUserid()));
  }
}
